<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>在线用户</title>
		<link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css" />
		<link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/dtree.css" />
		<link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/font/iconfont.css" />
	</head>
	<body>
		<div class="wrap-container clearfix">
			<div class="column-content-detail" id="tool">
				<!--<form class="layui-form" method="post" actiosysUserUser/export">
					<div class="layui-form-item">
						<div class="layui-inline tool-btn">
							<button class="layui-btn layui-btn-small layui-btn-danger deleteBtn" data-ursysUserUser/delete">
								&lt;!&ndash;<i class="layui-icon">&#xe640;</i>&ndash;&gt;删除
							</button>
						</div>
					</div>
				</form>-->
				<div class="layui-form" id="table-list">
					<table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
				</div>
			</div>
		</div>
		<!--操作-->
		<script type="text/html" id="entityBar">
			<button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">下线</button>
		</script>
		<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
		<script>
			layui.use(['jquery','table','page','form','dtreeUtil'],function(){
				var $ = layui.jquery,
					table = layui.table,
					page = layui.page,
					form=layui.form,
					dtreeUtil = layui.dtreeUtil;
				var tableIns=null;
				var url="/sysUser/pageOnline";
				var cols=[
					{type: 'checkbox', fixed: 'left'},
					{type: 'numbers', title: '序号'},
					{field: 'userName', title: '用户名称',align:'center'},
					{field: 'ipAddress', title: '登录地址',width:120,align:'center'},
					{field: 'startTimestamp', title: '创建时间', align:'center',width:170, templet:function(d){
						return new Date(d.startTimestamp).Format("yyyy-MM-dd hh:mm:ss");
					}},
					{field: 'lastAccessTime', title: '最后访问时间', align:'center',width:170, templet:function(d){
						return new Date(d.lastAccessTime).Format("yyyy-MM-dd hh:mm:ss");
					}},
					{title: '操作',width:170, templet:'#entityBar',align:"center"}
				];
				tableIns=page.initDate(cols,url);

				//监听行工具事件
				table.on('tool(entityList)', function(obj){
					var layEvent = obj.event,
						data = obj.data;
					if(layEvent === 'del'){ //下线功能
						page.delete("/sysUser/deleteOnline", {"sessionId":data.sessionId,"_method":"DELETE"},"确定踢出该用户吗？",function (data) {
							tableIns.reload();
						});
					}
				});
			});
		</script>
	</body>
</html>